<template>
  <div class="video-chat-window">
    <VideoChat 
      :remote-user="remoteUser"
      :is-incoming="isIncoming"
    />
  </div>
</template>

<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { useRoute } from 'vue-router'
import VideoChat from '../components/VideoChat.vue'

interface RemoteUser {
  userId: string
  name: string
  avatar: string
}

const route = useRoute()
const remoteUser = ref<RemoteUser | undefined>()
const isIncoming = ref(false)

onMounted(() => {
  // 从路由参数获取用户信息
  const userParam = route.query.user as string
  const incomingParam = route.query.incoming as string
  
  if (userParam) {
    try {
      remoteUser.value = JSON.parse(decodeURIComponent(userParam))
    } catch (error) {
      console.error('解析用户信息失败:', error)
    }
  }
  
  isIncoming.value = incomingParam === 'true'
})
</script>

<style scoped>
.video-chat-window {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}
</style> 